@extends('layout.member.master')
@section('content')
    <div class="card mt-4">
        <div class="card-body">
            <div class="header-body mt--5 mt-md--6">
                <div class="row align-items-center">
                    <div class="col">
                        <!-- Nav -->
                        <ul class="nav nav-tabs nav-overflow header-tabs">
                            <li class="nav-item">
                                <a href="{{route('admin.column.index')}}" class="nav-link ">
                                    编辑栏目
                                </a>
                            </li>
                        </ul>

                    </div>
                </div>
            </div>
        </div>
        <form action="{{route('admin.column.update',$column)}}" method="post">
            @csrf @method('PUT')
        <div class="card-body">

            <div class="form-group">
                <label for="">栏目标题</label>
                <input type="text" name="title" value="{{$column->title}}" class="form-control" placeholder="" aria-describedby="helpId">
            </div>
                <div class="form-group">
                    <label for="">栏目图标</label>
                    <div class="input-group mb-3">
                        <div class="input-group-prepend">
                            <span class="input-group-text">
                                <i id="icon" class="{{$column->icon}}"></i>
                            </span>

                        </div>
                        <input type="text" value="{{$column->icon}}" name="icon" class="form-control" aria-label="Amount (to the nearest dollar)">
                        <div class="input-group-append">
                            <a href="javascript:;" onclick="chooseIcon()"> <span class="input-group-text">选择图标</span></a>
                        </div>
                    </div>
                </div>

        </div>
        <div class="card-footer text-muted">
            <button type="submit" class="btn btn-success">保存</button>
        </div>
        </form>
    </div>

@endsection
@push('js')
    <script>
        function chooseIcon() {
            require(['hdjs'], function (hdjs) {
                hdjs.font(function(icon){
                    $('input[name=icon]').val(icon);
                    $('#icon').attr('class',icon);
                })
            })
        }
    </script>
    @endpush